<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type = "text/javascript">
        第一种创建对象
        var obj = new Object();
        obj.name = "zhz";
        obj.age = 18;
        obj.func = function(){
            alert("我是函数");
        }
        alert("姓名："+obj.name+"的年龄为："+obj.age);
        obj.func();
        第二种创建对象
        var obj1 = {
            name:"zhz",
            age:18,
            func:function() {
                alert("我是对象222");
            }
        };
        alert("姓名："+obj.name+"  年龄为："+obj.age);
        obj.func();
    </script>
</body>
</html>